<include file="./Tpl/Home/Header.html"/>
<link href="/Public/Home/jquery-ui-1.css" rel="stylesheet" type="text/css" media="screen, projection">
<link media="screen, projection" type="text/css" rel="stylesheet" href="/Public/Home/show.css">
<link media="screen, projection" type="text/css" rel="stylesheet" href="/Public/Home/global.css">
<link media="screen, projection" type="text/css" rel="stylesheet" href="/Public/Home/1200.css">
<body>
<div class="marketArea clear">
  <div class="main margin pathinfo"> 当前位置: <a href="/index">首页</a> <code>&gt;</code> <a href="/index.php/goods/index">商城</a> <code>&gt;</code> {$goods.title} </div>
  <div class="main showContent margin clearfix">
    <div class="gallery">
      <div id="detail">
        <div class="jqzoom_pm"> <img src="{$goods.pic}"> </div>
      </div>
    </div>
    <form action="" method="post" name="ECS_FORMBUY" id="ECS_FORMBUY">
      <div class="property">
        <h2>{$goods.title}</h2>
        <div class="goods_info">&nbsp;</div>
        <div class="ProductD clearfix">
          <div class="productDL">
            <dl>
              <dt>会&nbsp;&nbsp;员&nbsp;&nbsp;价：</dt>
              <dd> <span id="ECS_SHOPPRICE">￥{$goods.money_new}<input type="hidden" value="{$goods.pirce}" id="price"></span> </dd>
            </dl>
            <dl>
              <dt>市&nbsp;&nbsp;场&nbsp;&nbsp;价：</dt>
              <dd> <del>￥{$goods.money}</del> </dd>
            </dl>
            <dl>
              <dt>总&nbsp;&nbsp;库&nbsp;&nbsp;存：</dt>
              <dd> <strong>{$goods.num}件</strong> </dd>
            </dl>
            <dl>
              <dt>累计售出：</dt>
              <dd> <strong>{$count|default='0'}件</strong> </dd>
            </dl>
            <dl>
              <dt>上架时间：</dt>
              <dd>{$goods.add_time|date="Y-m-d H:i:s",###}</dd>
            </dl>
          </div>
        </div>
        <div class="buyinfo" id="detail_buyinfo">
          <dl>
            <dd>
              <div class="wrap_btn"> <a href="javascript:void(0);" onClick="show()" class="wrap_btn2" title="立即购买"></a> </div>
            </dd>
          </dl>
        </div>
      </div>
    </form>
  </div>
  <div class="main clearfix">
    <div class="mainListLeft fl">
      <div class="hotSell">
        <h4>热销榜</h4>
		<volist name="hot" id="vo">
        <dl>
          <dt> <a href="/Goods/view/id/{$vo.id}" title="{$vo.title}"><img src="{$vo.pic}" height="60px" width="60px"> </a> </dt>
          <dd>
            <p> <a href="Goods/view/id/{$vo.id}" title="{$vo.title}">{$vo.title}</a> </p>
            <span>￥{$vo.money_new}</span> </dd>
        </dl>
        </volist>
        
        
      </div>
    </div>
    <div class="mainListRight fr" id="status1" style="width:780px;">
      <div class="productContent">
        <div class="attributes-list"></div>
        <h3 class="techanPdcontent"> <strong>产品介绍</strong><span>Product Ovierview</span> </h3>
        <div class="techanProducts clearfix"></div>
        <div class="description">
          <p></p>
          <p> <span style="font-size:24px;">{$goods.title}</span></p>
          <p><img src="{$goods.pic}" alt="" width="600"></p>
          <p> <span>地址：{$goods.address}<br>
            电话：{$goods.tel}</span> </p>
        </div>
      </div>
    </div>
  </div>
</div>
</div>

<div class="okcoinPop" id="devolvePop" style="display:block;">

	<input type="hidden" name="rmbbili" value="{$goods.rmb_bili}" /><!-- 人民币比例-->
  <div class="dialog_content" id="dialog_content_devolve" style="margin-left: 0px; margin-top: 0px; left: 36%; top: 150px;width: 400px;">
    <div class="dialog_title" id="dialog_title_devolve"> <span id="titleInfo">购买商品</span> <a href="javascript:closeDevolve();" class="dialog_closed" title="关闭"></a> </div>
    <div class="dialog_body">
      <div style="padding:15px 0px;text-align: left;">
        <div style="height:30px;" class="clear">
          <div class="popDivInfo"> <span id="popSpanInfo1" class="popSpanInfo1">人民币金额：</span> <span class="InfoMoney"> ￥<span class="lightblue5 bold" id="amt">{$goods['money_new']*($goods['rmb_bili']/100)}</span></span> </div>
        </div>
        <div style="height:30px;" class="clear">
          <div class="popDivInfo"> <span id="popSpanInfo1" class="popSpanInfo1">{$bname}数量：</span> <span class="InfoMoney"> ￥<span class="lightblue5 bold" id="rac">{$goods['money_new']*(1-$goods['rmb_bili']/100)}</span></span> </div>
        </div>
        <div style="height:30px; margin-bottom:10px;" class="clear">
          <div class="popDivInfo"> <span id="popSpanInfo1" class="popSpanInfo1">付款方式：</span> <span class="InfoMoney">
            <select id="payType" style="height: 25px;width:160px;" onChange="javascript:payTypeSelect();">
              <option value="1" selected="selected">{$goods['rmb_bili']}%人民币+{$one*(100-$goods['rmb_bili'])}%{$bname}</option>
           
            </select>
            </span> </div>
        </div>
        <div style="height:30px; margin-bottom:10px;" class="clear">
          <div class="popDivInfo"> <span id="popSpanInfo1" class="popSpanInfo1">购买数量：</span> <span class="InfoMoney">
            <input id="buyQty" style="height: 25px;width:100px;" name="num" onBlur="javascript:payTypeSelect();"  />
            </span> </div>
        </div>
        <div style="height:30px; margin-bottom:10px;" class="clear">
          <div class="popDivInfo"> <span id="popSpanInfo1" class="popSpanInfo1">手机号码：</span> <span class="InfoMoney">
            <input id="tel" style="height: 25px;width:200px;" name="tel" />
            </span> </div>
        </div>
        <div style="height:30px;" class="clear">
          <div class="popDivInfo"> <span id="popSpanInfo1" class="popSpanInfo1">收货地址：</span> <span class="InfoMoney">
            <input id="address" style="height: 25px;width:250px;" name="address" /> 
			<input name="good_id" value="{$goods.id}"  type="hidden" id="good_id"/>
            </span> </div>
        </div>
        <div class="errorTips" id="devolveErrorTips"></div>
        <div class="center"> <a class="buttonLoanGreen" onClick="javascript:payTypeSelect();" id="devolveSub">刷新价格</a> <a class="buttonLoanRed" onClick="buy()" id="devolveSub">确认购买</a> </div>
      </div>
    </div>
  </div>
</div>
<script>
	var rnum=$("#amt").text();
	var xnum=$("#rac").text();
	function payTypeSelect(){
			var num=$("#buyQty").val();
			var price=$("#price").val();
			var ptype=parseInt($("#payType").val());
			//	var rmb_bili={$rmb_bili|default=0};
		//	var xnb_bili={$xnb_bili|default=0};

			$("#amt").text(Math.round(rnum*num*100)/100);
			$("#rac").text(Math.round(xnum*num*100)/100);
			
		}
	function buy(){
			var goodsid=$("#good_id").val();
			var num=$("#buyQty").val();
			var tel=$("#tel").val();
			
			var address=$("#address").val();			
			$.post("/Home/Goods/add_goods",{"goodsid":goodsid,"num":num,"tel":tel,"address":address},function(data){
				if(data.status==1){
					alert("购买成功");
					location.reload();
				}else{
					alert(data.info);
					}
			})
			
	}
	function show(){
		//	var rmb_bili={$rmb_bili|default=0};
		//	var xnb_bili={$xnb_bili|default=0};
			$("#devolvePop").show()
			//$("#payType").html(rmb_bili+"%人民币+"+xnb_bili+"%{$bname}")
	}
	function closeDevolve(){
			$("#devolvePop").hide()
		}
</script>
<include file="./Tpl/Home/Footer.html"/>
</body>
</html>